using System;
using System.Data;
using System.Collections;

namespace APP.QUANLY.Entity
{
    /// <summary>
    /// Summary description for NHACUNGCAP.
    /// </summary>
    public class NHACUNGCAPList : CollectionBase
    {
		private string _ErrMsg;
        public string ErrMsg { get { return _ErrMsg; } }
    	public NHACUNGCAPList()
    	{
	    }

		public void Add(NHACUNGCAP entity)
		{
            this.List.Add(entity);
		}

		public void Add(NHACUNGCAPList list)
		{	
			foreach(NHACUNGCAP entity in list)
			{
				this.Add(entity);
			}
		}
	
		public new virtual Enumerator GetEnumerator()
		{
		    return new Enumerator(this);
		}
		public virtual NHACUNGCAP this[int index]
		{
		    get
			{
				return (NHACUNGCAP)this.List[index];
			}
			set
			{
				this.List[index] = value;
			}
		}

		#region Find Object And List Object
		//---PrimaryKey
	public virtual NHACUNGCAP Find(Int32 MANHACUNGCAP)
	{
	    foreach (NHACUNGCAP obj in this.List)
	    {
		if(obj.MANHACUNGCAP.ToString().ToUpper().Trim() == MANHACUNGCAP.ToString().ToUpper().Trim())
		{
		    obj.IsExisting = true;
		    return obj;
		}
	    }
	    return null;
	}

public virtual NHACUNGCAPList FindListByMANHACUNGCAP(Int32 MANHACUNGCAP)
{
	try
	{
		NHACUNGCAPList List = new NHACUNGCAPList();
		foreach (NHACUNGCAP obj in this.List)
		{
		    if(obj.MANHACUNGCAP.ToString().ToUpper().Trim() == MANHACUNGCAP.ToString().ToUpper().Trim())
		    {
				List.Add(obj);
		    }
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
    	{
		_ErrMsg = ex.Message;
        		return null;
    	}
}
		//---NonPrimaryKey
        public virtual NHACUNGCAP FindByTENNHACUNGCAP(string TENNHACUNGCAP)
        {
	        foreach (NHACUNGCAP obj in this.List)
	        {
		        if(obj.TENNHACUNGCAP.ToString().ToUpper().Trim() == TENNHACUNGCAP.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHACUNGCAP FindByDIACHI(string DIACHI)
        {
	        foreach (NHACUNGCAP obj in this.List)
	        {
		        if(obj.DIACHI.ToString().ToUpper().Trim() == DIACHI.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHACUNGCAP FindByDIENTHOAI(string DIENTHOAI)
        {
	        foreach (NHACUNGCAP obj in this.List)
	        {
		        if(obj.DIENTHOAI.ToString().ToUpper().Trim() == DIENTHOAI.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHACUNGCAP FindByDIDONG(string DIDONG)
        {
	        foreach (NHACUNGCAP obj in this.List)
	        {
		        if(obj.DIDONG.ToString().ToUpper().Trim() == DIDONG.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHACUNGCAP FindByNGUOIDAIDIEN(string NGUOIDAIDIEN)
        {
	        foreach (NHACUNGCAP obj in this.List)
	        {
		        if(obj.NGUOIDAIDIEN.ToString().ToUpper().Trim() == NGUOIDAIDIEN.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHACUNGCAP FindByEMAIL(string EMAIL)
        {
	        foreach (NHACUNGCAP obj in this.List)
	        {
		        if(obj.EMAIL.ToString().ToUpper().Trim() == EMAIL.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHACUNGCAP FindByTHEODOI(bool THEODOI)
        {
	        foreach (NHACUNGCAP obj in this.List)
	        {
		        if(obj.THEODOI.ToString().ToUpper().Trim() == THEODOI.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHACUNGCAP FindByISDELETE(bool ISDELETE)
        {
	        foreach (NHACUNGCAP obj in this.List)
	        {
		        if(obj.ISDELETE.ToString().ToUpper().Trim() == ISDELETE.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual NHACUNGCAP FindByGHICHU(string GHICHU)
        {
	        foreach (NHACUNGCAP obj in this.List)
	        {
		        if(obj.GHICHU.ToString().ToUpper().Trim() == GHICHU.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

public virtual NHACUNGCAPList FindListByTENNHACUNGCAP(string TENNHACUNGCAP)
{
	try
	{
		NHACUNGCAPList List = new NHACUNGCAPList();
		foreach (NHACUNGCAP obj in this.List)
		{
			if(obj.TENNHACUNGCAP.ToString().ToUpper().Trim() == TENNHACUNGCAP.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHACUNGCAPList FindListByDIACHI(string DIACHI)
{
	try
	{
		NHACUNGCAPList List = new NHACUNGCAPList();
		foreach (NHACUNGCAP obj in this.List)
		{
			if(obj.DIACHI.ToString().ToUpper().Trim() == DIACHI.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHACUNGCAPList FindListByDIENTHOAI(string DIENTHOAI)
{
	try
	{
		NHACUNGCAPList List = new NHACUNGCAPList();
		foreach (NHACUNGCAP obj in this.List)
		{
			if(obj.DIENTHOAI.ToString().ToUpper().Trim() == DIENTHOAI.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHACUNGCAPList FindListByDIDONG(string DIDONG)
{
	try
	{
		NHACUNGCAPList List = new NHACUNGCAPList();
		foreach (NHACUNGCAP obj in this.List)
		{
			if(obj.DIDONG.ToString().ToUpper().Trim() == DIDONG.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHACUNGCAPList FindListByNGUOIDAIDIEN(string NGUOIDAIDIEN)
{
	try
	{
		NHACUNGCAPList List = new NHACUNGCAPList();
		foreach (NHACUNGCAP obj in this.List)
		{
			if(obj.NGUOIDAIDIEN.ToString().ToUpper().Trim() == NGUOIDAIDIEN.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHACUNGCAPList FindListByEMAIL(string EMAIL)
{
	try
	{
		NHACUNGCAPList List = new NHACUNGCAPList();
		foreach (NHACUNGCAP obj in this.List)
		{
			if(obj.EMAIL.ToString().ToUpper().Trim() == EMAIL.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHACUNGCAPList FindListByTHEODOI(bool THEODOI)
{
	try
	{
		NHACUNGCAPList List = new NHACUNGCAPList();
		foreach (NHACUNGCAP obj in this.List)
		{
			if(obj.THEODOI.ToString().ToUpper().Trim() == THEODOI.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHACUNGCAPList FindListByISDELETE(bool ISDELETE)
{
	try
	{
		NHACUNGCAPList List = new NHACUNGCAPList();
		foreach (NHACUNGCAP obj in this.List)
		{
			if(obj.ISDELETE.ToString().ToUpper().Trim() == ISDELETE.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual NHACUNGCAPList FindListByGHICHU(string GHICHU)
{
	try
	{
		NHACUNGCAPList List = new NHACUNGCAPList();
		foreach (NHACUNGCAP obj in this.List)
		{
			if(obj.GHICHU.ToString().ToUpper().Trim() == GHICHU.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}
		#endregion
     
		#region Inner Classes
		/// <summary>
		/// Type-specific enumeration class, used by LogCollection.GetEnumerator.
		/// </summary>
		public class Enumerator : IEnumerator
		{
			private IEnumerator wrapped;

			public Enumerator(NHACUNGCAPList collection)
			{
				this.wrapped = ((CollectionBase)collection).GetEnumerator();
			}

			public NHACUNGCAP Current
			{
				get
				{
					return (NHACUNGCAP)(this.wrapped.Current);
				}
			}

			object IEnumerator.Current
			{
				get
				{
					return (NHACUNGCAP)(this.wrapped.Current);
				}
			}

			public bool MoveNext()
			{
				return this.wrapped.MoveNext();
			}

			public void Reset()
			{
				this.wrapped.Reset();
			}
      }
      #endregion  
   }
}